<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) of templateGroupList" :key="index">
        <TemplateContent :templateGroupId="item.id" v-if="activeName == item.name"></TemplateContent>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import { listTemplateGroup} from "@/api/codegen/templateGroup";
import TemplateContent from './content.vue'
export default {
  name: "TEMPLATE",
  data() {
    return {
      // 模板分组
      templateGroupList:[],
      activeName: 'default'
    };
  },
  components: {
    TemplateContent
  },
  created() {
    listTemplateGroup({pageNum:1,pageSize:100}).then(response => {
      this.templateGroupList = response.rows
    });
  },
  methods: {
    handleClick(tab, event) {
      this.activeName = tab.label
    }
  }
};
</script>
